package com.zhanghe.study.demo.es;

/**
 * @author zh
 * @date 2022/4/6 15:40
 */
public class TestCsv {
    public static void main(String[] args) {
        String csv = "904,欧莱雅-科颜氏KHLSMCC-202203-15s开机,1648051200000,1649865599999,6,4,[0\\,1\\,2\\,3\\,4\\,5\\,6\\,7\\,8\\,9\\,10\\,11\\,12\\,13\\,14\\,15\\,16\\,17\\,18\\,19\\,20\\,21\\,22\\,23],0,[\"27\"\\,\"26\"\\,\"22\"\\,\"34\"\\,\"14\"\\,\"31\"\\,\"29\"\\,\"23\"\\,\"3\"\\,\"28,22\"\\,\"20\"\\,\"32\"\\,\"47\"\\,\"35\"\\,\"8\"\\,\"83\"\\,\"50\"\\,\"46\"\\,\"33\"\\,\"30\"],0,0,0,98,10040,55,10000,0,[],0,0,0,0,[],0,0,0,0,[]";
        //  ,(?=([^"]*"[^"]*")*[^"]*$)(?!([^[]*]))   匹配逗号  且去除掉 ""内的 以及 []内的
        String csvSplitBy = ",(?=([^\"]*\"[^\"]*\")*[^\"]*$)(?!([^\\[]*]))";

        String[] split = csv.split(csvSplitBy);

        for(String column : split){
            System.out.println(column);
        }
    }
}
